package com.stiove.whwh.dao.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.stiove.whwh.dao.pojo.UserLike;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

@Mapper
public interface UserLikeMapper extends BaseMapper<UserLike> {
    @Update("update user_like SET delete_time = #{time} where ticket_id = #{id}")
    public int deleteByTicketId(int id,long time);

    @Update("update user_like SET delete_time = #{time} where (ticket_id = #{tid} and user_id = #{uid})")
    public int deleteByUserId(int tid,Long uid,long time);


    @Select("SELECT * From user_like where (ticket_id = #{ticketId} and user_id = #{userId} and delete_time is NULL )")
    public UserLike getIsLike(long userId,long ticketId);

    @Select("SELECT * From user_like where (user_id = #{userId} and delete_time is NULL )")
    public UserLike getLikeByUserId(long userId);
}
